
/* ______________________________________________________________________

	Vaca Framework
	http://vaca-framework.googlecode.com/

	License: MIT License
   ______________________________________________________________________
*/

var Vaca = {
	version: '0.1b',
	
	// Namespaces
	DataStructures: {},
	Controllers: {},
	UI: {}
}

Vaca.ObjectPool = {
	pool: new Array(),
	add: function(object) {
		this.pool.push(object);
	},
	remove: function(object) {
		return this.pool.shift();
	},
	sendMessage: function(sender, msg) {
		this.pool.each(function(object){
			if (object != sender)
				object.processPoolMessage(sender, msg);
		});
	}
}

Vaca.BaseObject = new Class({
	ClassName: 'BaseObject',
	initialize: function() {
		Vaca.ObjectPool.add(this);
	},
	sendMessageToPool: function(msg) {
		Vaca.ObjectPool.sendMessage(this, msg);
	},
	processPoolMessage: function(sender, msg) {
		console.log(this.ClassName + ': msg from ' + sender.ClassName);
	}
});
